﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Flit.Samples.GivenWhenThen
{
    /// <summary>
    /// These aren't really tests (in the assert sense), they just demonstrate (and print out) what's going on
    /// </summary>
    [TestFixture]
    public class Usage
    {
        [Test]
        [Ignore]
        public void ThisTestShouldPass()
        {
            int x=0, y=0, r=0;
            Story s = new Story("AddingNumbers");
            s.Given("x is five", () => x = 5 )
               .And("y is six",  () => y = 6)
               .When("I add x and y", ()=>r=GoodAdd(x,y))
               .Then("I should get 11", ()=> Assert.AreEqual(11, r));

            s.Execute();
        }

        [Test]
        [Ignore]
        public void ThisTestShouldFail()
        {
            int x=0, y=0, r=0;
            Story s = new Story("AddingNumbers");
            s.Given("x is five", () => x = 5 )
               .And("y is six",  () => y = 6)
               .When("I add x and y", ()=>r=BadAdd(x,y))
               .Then("I should get 11", ()=> Assert.AreEqual(11, r));

            s.Execute();
        }

        private int GoodAdd(int x, int y)
        {
            return x + y;
        }

        private int BadAdd(int x, int y)
        {
            return -13;
        }
    }
}
